1. Field of the Invention
Embodiments of the present invention relate to encoding and decoding of a digital signal, and more particularly, to a method and apparatus for encoding/decoding a digital signal, in which a digital signal is encoded into a bit stream including information about a length of a frame by using a plurality of lookup tables and linear quantization by sections, and the bit stream is decoded into the original digital signal.
2. Description of the Related Art
FIG. 1 is a block diagram of a general digital signal encoding apparatus using an psycho-acoustic model in the MPEG-1. The general digital signal encoding apparatus is comprised of a frequency mapping portion 100, psycho-acoustic model 110, a bit allocation portion 120, a quantization portion 130, and a bitstream producing portion 140.
The frequency mapping portion 100 transforms a time-domain input signal into a predetermined number of frequency bands using a band analysis filter. The psycho-acoustic model 110 is a portion of the encoding apparatus that performs the most complicate calculation. That is, the psycho-acoustic model 110 calculates a signal-to-mask ratio (SMR), which is a basis of bit allocation for each frequency band. The SMR is calculated by the following operations. First, a time-domain audio signal is transformed into a frequency-domain audio signal using fast Fourier transform (FFT), and a sound pressure level and an absolute threshold of each frequency band are calculated. Thereafter, voice and voiceless sound components of the audio signal and a masker of the audio signal are determined, and a masking threshold of each frequency band and an overall masking threshold are calculated. Finally, a minimal masking threshold of each frequency band is calculated, thereby calculating the SMR of each frequency band.
The bit allocation portion 120 calculates the number of bits to be allocated for each frequency band by repeating the following operations based on the SMR received from the psycho-acoustic model 110. First, an initial allocated bit is set as 0, and a mask-to-noise ratio (MNR) for each frequency band is obtained. Here, the MNR is obtained by subtracting the SMR from a signal-to-noise ratio (SNR). Thereafter, a frequency band having the minimal MNR among MNRs for the frequency bands is searched for, and the number of bits allocated for the found frequency band increases 1. If the number of bits allocated for the entire input signal does not exceed a required number of allocated bits, frequency bands other than the found frequency band undergo the above-described operations.
The quantization portion 130 quantizes the input signal using a scale vector and allocated bits. The bitstream producing portion 140 produces a bit stream using the quantized input signal.
As described above, a conventional digital signal encoding method using psycho-acoustic model obtains an SMR through a complicate process. Thus, a calculation performed in the conventional digital signal encoding method becomes complicated, leading to an increase in the time required to execute the digital signal encoding method. Since an MNR is calculated using the SMR obtained through the complicate process, and a bit allocation loop is repeated based on the MNR, time delay also occurs during the repetition of the bit allocation loop.
FIG. 2 is a block diagram of a conventional digital signal encoding apparatus using a single lookup table. The encoding apparatus is comprised of a frequency mapping portion 200, a lookup table 210, a number-of-allocated-bits extraction portion 220, a quantization portion 230, and a bitstream producing portion 240.
The frequency mapping portion 200 transforms a time-domain input signal into a predetermined number of frequency bands using a band analysis filter. The lookup table 210 stores numbers of bits allocated to encode the frequency bands, in addresses corresponding to characteristics of the frequency bands.
The number-of-allocated-bits extraction portion 220 calculates an address value for each of the frequency bands of the input signal and extracts the numbers of allocated bits stored in the addresses for the frequency bands from the lookup table 210. The quantization portion 230 quantizes the input signal using the numbers of bits allocated for the frequency bands. The bitstream producing portion 240 produces a bitstream using the quantized input signal.
In a conventional method of encoding a digital signal using a single lookup table, to obtain a number of bits allocated for a unit in which the digital signal is quantized (hereafter, referred to as a quantization unit) as described above, the numbers of bits allocated per frequency band are extracted from the lookup table and used in encoding the digital signal. Hence, the complicated calculation and the time delay due to the use of a psycho-acoustic model can be prevented. However, since various input signals having different characteristics must be encoded using the single lookup table, there exists a limit in adaptively encoding the input signals according to their characteristics.
In the MPEG-1/2 audio encoding technology, sub-band samples obtained by sub-band filtering are linearly quantized using information about bit allocation presented by psychoacoustics and undergo a bit packing process, thereby completing audio encoding. A linear quantizer, which performs the linear quantization, provides optimal performance when data has a uniform distribution. However, a data distribution is actually approximate to a Guassian or Laplacian distribution. Hence, the quantizer is preferably designed to fit each distribution, and can show an optimal result in respect of a mean squared error (MSE). A general audio encoder, such as, an MPEG-2/4 Advanced Audio Coding (AAC) encoder, uses a x4/3 nonlinear quantizer, which is designed in consideration of a sample distribution of a modified discrete cosine transform (MDCT) and the psycho-acoustic perspective. However, the encoder is highly complex due to the characteristics of a nonlinear quantizer. Therefore, the nonlinear quantizer cannot be used as an audio encoder that requires low complexity.
When audio encoding proposed by MPEG-1 and MPEG-2 is performed using a fixed bitrate, sync information is located at a beginning portion of each frame. When audio encoding proposed by MPEG-4 is not performed at a fixed bitrate, information about a frame length is located at a beginning portion of each frame.
When an impact is applied to an audio reproducing apparatus, only effective data, which is not affected by the impact, except for an impacted portion of a buffer in the audio reproducing apparatus should be reproduced. When an encoding rate used is a fixed bit rate, a length of each frame, that is, a size of an area of the buffer occupied by each frame, is consistent. Accordingly, an area of the buffer occupied by a frame previous to a damaged frame can be easily searched for. On the other hand, when the encoding rate used is a variable bit rate, a length of each frame, that is, a size of an area of the buffer occupied by each frame, is inconsistent. Accordingly, it is impossible to search for an area of the buffer occupied by a frame previous to a damaged frame by only using frame length information recorded at a beginning portion of each frame.